<template>
	<coreshop-page title="设置" mode="left">
		<view class="layout-set-box">
			<view class="item-box" @click="handleRouteNavigateTo(`/pages/subpackage/member/set/userInfo/userInfo`)">
				<view class="title-box">
					<uv-icon name="setting" size="18" color="#000"></uv-icon>
					<view class="title">个人资料</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<!-- #ifdef APP-PLUS || APP-PLUS-NVUE -->
			<view class="item-box" @click="handleRouteNavigateTo(`/pages/subpackage/member/set/password/password`)">
				<view class="title-box">
					<uv-icon name="empty-list" size="18" color="#000"></uv-icon>
					<view class="title">修改密码</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<!-- #endif -->
			<view class="item-box"
				@click="handleRouteNavigateTo(`/pages/subpackage/article/detail/detail?id=${shopConfigStore?.config?.aboutArticleId}`)">
				<view class="title-box">
					<uv-icon name="account" size="18" color="#000"></uv-icon>
					<view class="title">关于我们</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<view class="item-box"
				@click="handleRouteNavigateTo(`/pages/subpackage/article/detail/detail?id=${shopConfigStore?.config?.userAgreementId}`)">
				<view class="title-box">
					<uv-icon name="file-text" size="18" color="#000"></uv-icon>
					<view class="title">用户协议</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<view class="item-box"
				@click="handleRouteNavigateTo(`/pages/subpackage/article/detail/detail?id=${shopConfigStore?.config?.privacyPolicyId}`)">
				<view class="title-box">
					<uv-icon name="eye-off-outline" size="18" color="#000"></uv-icon>
					<view class="title">隐私政策</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<!-- #ifdef APP-PLUS || APP-PLUS-NVUE -->
			<view class="item-box" @click="handleChangeAccount">
				<view class="title-box">
					<uv-icon name="account" size="18" color="#000"></uv-icon>
					<view class="title">切换账号</view>
				</view>
				<uv-icon name="arrow-right" size="18" color="#000"></uv-icon>
			</view>
			<view class="log-off" @click="handleLoinOff">退出登录</view>
			<!-- #endif -->
		</view>
	</coreshop-page>
</template>
<script setup lang="ts">
	import { hanldeShowModal, handleRouteSwitchTab, handleRouteNavigateTo } from '@/core/utils';
	import { UserToken } from '@/core/consts';
	import { useShopConfigStore } from '@/core/store';

	// 获取项目配置
	const shopConfigStore = useShopConfigStore();

	/** 退出 */
	const handleLoinOff = () => {
		hanldeShowModal({
			title: "退出",
			content: "确认退出登录吗?",
			confirmFn: () => {
				uni.removeStorage({ key: UserToken });
				handleRouteSwitchTab();
			}
		})
	}

	/** 切换账号 */
	const handleChangeAccount = () => {
		hanldeShowModal({
			title: "切换",
			content: "确认切换登录账号吗?",
			confirmFn: () => {
				uni.removeStorage({ key: UserToken });
				handleRouteNavigateTo('/pages/login/login');
			}
		})
	}
</script>
<style lang="scss" scoped>
	@import './index.scss';
</style>